-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/mt - Improve performance with threads and other optimizations #62
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since SDL is really ambiguous about rendering from another thread the emulation is running on another thread. Using crossbeam parker for sync between threads (Some kind of AutoResetEvent from C#) And using rtrb for the ring buffer queue for moving data between the threads
chose criterion cause the regualr one is stil unstable. test with `cargo bench`
- Use crossbeam-utils instead of the whole lib - Cache the analog sample in the channel instead of calculating it each time
This optimization gained a crazy performance boost! Probably cause of the lack of division in the new solution.
I was checking optimization of replacing f32 with u16 or u32 but it seems that f32 is the better option, anyway if another platform will need replacing (or adding a compile condition should be easier).
Add proper handling of closing the program
# Conflicts: # Cargo.lock # lib_gb/Cargo.toml
The merge broke some code in the tests
Which turn to be faster (with blocking involved.
In order to abstract the sample type primitive.
This should improve performance of the sound terminal
# Conflicts: # gb/src/audio_resampler.rs # lib_gb/benches/my_bench.rs # lib_gb/src/apu/audio_device.rs # lib_gb/src/apu/channel.rs # lib_gb/src/apu/gb_apu.rs # lib_gb/src/apu/sound_terminal.rs
Casued by merge shit
This is important since it can cause flickering in the sound
* Inline it, for some reason it wont be inlined automaticaly * Instead of multiplying with 1 or 0 Im anding with 0xFFFF or 0
Update thhe ppu and the apu dev status
There ware too much cloning whcih caused a BO in debug mode. Using pointer casted to usize to communicate between threads and a multi buffering in the ppu (to avoid race conditions, at least I hope) I managed to solve this issue in debug mode too!
Instead of cycling every t_cycle the apu now cycle in m_cycle increasing its performance by almost 4! This will hust emulation accuracy but I think I can live with this minor hit :D
Add frame cap using SDL_Delay. Also add the option to configure the emulation speed (both ppu and apu)
* Audio pull by deafult and under the featue flag - push-audio * vsync is on by default and by passing `--no-vsync` it can be disabled
There are 2 flags * sdl-resample - will compile the sdl resampler instead of my resampler * push-audio - will push the audio to the device instead of the device pulling it by himslef.
The apu timer test was outdated. The apu timer counts in tcycles but increment itself each time by 4 cycles and not 1.
alloncm
commented
Nov 1, 2021
alloncm
commented
Nov 1, 2021
alloncm
commented
Nov 3, 2021
alloncm
changed the title
Feature/mt - Improve performance with threads
Feature/mt - Improve performance with threads and other optimizations
Nov 4, 2021
Also fIxed a typo in the sdl-resample feature
According to the benchmark this has improved performance a bit :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #57
Closes #53
Closes #34